package com.practice2.exercise;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {
    public static void main(String[] args) {
        // 创建Spring容器，加载配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("user.xml");
        // 从容器中获取user1 Bean
        User user1 = (User) context.getBean("user1");
        // 从容器中获取user2 Bean
        User user2 = (User) context.getBean("user2");
        // 调用show方法
        user1.show();
        user2.show();
    }
}